home *** CD-ROM | disk | FTP | other *** search
/ Scene 96 / Scene 96 International Edition (Zyklop Software) (Disc 2) (1997).iso / misc / coding / dp_srccs / hotfire.asm < prev    next >
Encoding:
Assembly Source File  |  1996-12-08  |  12.1 KB  |  478 lines

  1. ────────────────────────────────────────────────────────────────────────────────
  2. ; plasmoid/deep 1995:
  3. ; well here it is another kewl code by plasmoid...diz code is awfull hot and
  4. ; dedicated to a little girly, i donno if i should start a funky offensiv in
  5. ; order to get connected ;)...we'll see... press return to stemp a logo in
  6. ; the fire
  7. ; ("1996: if my girlfriend had known this text ^^ , PEINLICH!")
  8. ────────────────────────────────────────────────────────────────────────────────
  9. .model tiny
  10. code            segment use16
  11.         assume  cs:code,ds:code
  12.         org     100h
  13.         locals
  14. xsize        equ    320
  15. ysize        equ    70
  16. hotfire:        jmp     main
  17. include        ocean.pal
  18. info        db     " ∙ hot fire ∙ code by plasmoid ∙ "
  19. ────────────────────────────────────────────────────────────────────────────────
  20. .386                        ; ∙ here we go again...
  21. ────────────────────────────────────────────────────────────────────────────────
  22. shades        proc    near
  23.         mov    bp,8*2
  24. five:        mov    ax,shad1x[bp]
  25.         mov    bx,shad1y[bp]
  26.         mov    si,shad2x[bp]
  27.         mov    di,shad2y[bp]
  28.         call    line
  29.         mov    ax,dire1x[bp]
  30.         add    shad1x[bp],ax
  31.         mov    ax,dire2x[bp]
  32.         add    shad2x[bp],ax
  33.         mov    ax,dire1y[bp]
  34.         add    shad1y[bp],ax
  35.         mov    ax,dire2y[bp]
  36.         add    shad2y[bp],ax
  37.         sub    bp,2
  38.         jnz    five
  39.  
  40.         mov    bp,8*2
  41. check:        cmp    shad1x[bp],4
  42.         jb    toosmallx1
  43.         cmp    shad2x[bp],4
  44.         jb    toosmallx2
  45.         cmp    shad1x[bp],310
  46.         ja    toosmallx1
  47.         cmp    shad2x[bp],310
  48.         ja    toosmallx2
  49.         cmp    shad1y[bp],4
  50.         jb    toosmally1
  51.         cmp    shad2y[bp],4
  52.         jb    toosmally2
  53.         cmp    shad1y[bp],60
  54.         ja    toosmally1
  55.         cmp    shad2y[bp],60
  56.         ja    toosmally2
  57.         jmp    cont
  58. toosmallx1:    neg    dire1x[bp]
  59.         jmp    cont
  60. toosmally1:    neg    dire1y[bp]
  61.         jmp    cont
  62. toosmallx2:    neg    dire2x[bp]
  63.         jmp    cont
  64. toosmally2:    neg    dire2y[bp]
  65. cont:        sub    bp,2
  66.         jnz    check
  67.         ret
  68. shad1x        dw    120,010,040,310,240,020,210,140,210,140
  69. shad1y        dw    050,030,020,004,063,023,014,042,030,045
  70. shad2x        dw    150,110,240,010,140,220,045,035,023,022
  71. shad2y        dw    030,060,010,044,023,064,021,045,060,006
  72. dire1x        dw     -1,  1, -1, -1,  1,  1,  1,  1, -1,  1
  73. dire1y        dw        1, -1, -1,  1, -1, -1, -1, -1, -1, -1
  74. dire2x        dw      1, -1, -1,  1, -1,  1, -1, -1, -1, -1
  75. dire2y        dw        1,  1, -1, -1,  1, -1,  1, -1,  1,  1
  76. shades          endp
  77. ────────────────────────────────────────────────────────────────────────────────
  78. pixel           proc near
  79.         push    dx                      ; ∙ ax-x bx-y
  80.         push    bx
  81.         push    ax
  82.         mov     dx,ax                   ; ∙ multis y * 320
  83.         shl     dx,8                    ;   using    * 256
  84.         shl     ax,6                    ;   using    *  64
  85.         add     ax,dx                   ;            = 320
  86.         add     bx,ax                   ; ∙ add y to x
  87.         cmp    byte ptr ds:fireblock[bx],250-30
  88.         ja    @okay
  89. @inc:           add     byte ptr ds:fireblock[bx],15        ; ∙ mov it!
  90. @okay:          pop     ax
  91.         pop     bx
  92.         pop     dx
  93.         ret
  94. pixel           endp
  95. ────────────────────────────────────────────────────────────────────────────────
  96. line            proc near
  97.         s1      equ [bp-10h]            ; ∙ ax-x bx-y
  98.         s2      equ [bp-0eh]            ; ∙ si-x bx-y
  99.         s3      equ [bp-0ch]
  100.         s4      equ [bp-0ah]
  101.         x1      equ [bp-08h]
  102.         y1      equ [bp-06h]
  103.         x2      equ [bp-04h]
  104.         y2      equ [bp-02h]
  105.  
  106.         enter   10h,0
  107.         mov     x1,ax                   ; ∙ here cum some nice
  108.         mov     y1,bx                   ;   explaining words
  109.         mov     x2,si
  110.         mov     y2,di
  111.         mov     si,x2                   ; ∙ checks if sign
  112.         sub     si,x1                   ;   meaning if  or 
  113.         jns     @lab1
  114.         neg     si                      ; ∙ change sign
  115. @lab1:          mov     di,y2                   ; ∙ checks if sign
  116.         sub     di,y1                   ;   meaning if  or 
  117.         jns     @lab2
  118.         neg     di                      ; ∙ change sign
  119. @lab2:          cmp     si,di
  120.         jge     @lab3a                  ; ∙ m <= 1
  121.         jmp     @lab20                  ; ∙ m >  1
  122.  
  123. @lab3a:         mov     bx,x1                   ; ∙ checks if x1 <= x2
  124.         cmp     bx,x2
  125.         jg      @lab4
  126.         mov     bx,1                    ; ∙ go right!
  127.         jmp     @lab5
  128. @lab4:          mov     bx,-1                   ; ∙ go left!
  129. @lab5:          mov     ax,y1                   ; ∙ checks if y1 <= y2
  130.         cmp     ax,y2
  131.         jg      @lab6
  132.         mov     ax,1                    ; ∙ go up!
  133.         jmp     @lab7
  134.  
  135. @lab6:          mov     ax,-1                   ; ∙ go down!
  136. ; small comment: Going down, mayday, mayday (from Comanche)
  137. @lab7:          mov     s1,bx                   ; ∙ save m on stack
  138.         mov     s2,ax
  139.         add     di,di                   ; ∙ draw point
  140.         mov     s3,di
  141.         sub     di,si
  142.         mov     bx,di
  143.         sub     bx,si
  144.         mov     s4,bx
  145.         mov     bx,x1
  146.         mov     ax,y1
  147.         call    pixel
  148.  
  149. @lab8:          cmp     bx,x2                   ; ∙ points left?
  150.         jz      @lab3
  151.         add     bx,s1                   ; ∙ increases x
  152.         or      di,di                   ; ∙ checks if y should
  153.         jns     @lab10                  ;   be increased
  154.         add     di,s3
  155.         jmp     @lab11
  156. @lab10:         add     di,s4                   ; ∙ next point
  157.         add     ax,s2
  158. @lab11:         call    pixel
  159.         jmp     @lab8
  160.  
  161. @lab20:         mov     bx,y1                   ; ∙ checks if y1 <= y2
  162.         cmp     bx,y2
  163.         jg      @lab12
  164.         mov     bx,1                    ; ∙ go up!
  165.         jmp     @lab13
  166.  
  167. @lab12:         mov     bx,-1                   ; ∙ go down!
  168. ; small comment: Going down, mayday, mayday (from Comanche)
  169. @lab13:         mov     ax,x1                   ; ∙ checks if x1 <= x2
  170.         cmp     ax,x2
  171.         jg      @lab14
  172.         mov     ax,1                    ; ∙ go right!
  173.         jmp     @lab15
  174. @lab14:         mov     ax,-1                   ; ∙ go left!
  175. @lab15:         mov     s1,bx                   ; ∙ save m on stack
  176.         mov     s2,ax
  177.         add     si,si                   ; ∙ draw point
  178.         mov     s3,si
  179.         sub     si,di
  180.         mov     bx,si
  181.         sub     bx,di
  182.         mov     s4,bx
  183.         mov     di,si
  184.         mov     bx,x1
  185.         mov     ax,y1
  186.         call    pixel
  187. @lab16:         cmp     ax,y2                   ; ∙ points left?
  188.         jz      @lab3
  189.         add     ax,s1                   ; ∙ increases x
  190.         or      di,di                   ; ∙ checks if y should
  191.         jns     @lab18                  ;   be increased
  192.         add     di,s3
  193.         jmp     @lab19
  194. @lab18:         add     di,s4                   ; ∙ next point
  195.         add     bx,s2
  196. @lab19:         call    pixel
  197.         jmp     @lab16
  198.  
  199. @lab3:          leave
  200.         ret
  201. line            endp
  202.  
  203. ────────────────────────────────────────────────────────────────────────────────
  204. displaylogo    proc    near
  205.         mov    si,offset vgalogo
  206.         mov    di,offset fireblock+21*320+60
  207.         mov    bx,39
  208. pic2fire:    mov    cx,200
  209. pis2fire:    mov    al,ds:[si]
  210.         cmp    al,00
  211.         je    nopixel
  212.         mov    ds:[di],al
  213. nopixel:    inc    si
  214.         inc    di
  215.         loop    pis2fire
  216.         add    di,320-200
  217.         dec    bx
  218.         jnz    pic2fire
  219.         ret
  220. displaylogo    endp
  221. ────────────────────────────────────────────────────────────────────────────────
  222. convert         proc    near
  223.         xor     bx,bx
  224. @@two:          mov     cx,bp           ; ∙ lg to cx
  225. @@one:          xor     dx,dx
  226.         mov     dl,ds:[si]      ; ∙ read from srce to dl
  227.         mov     bl,dl           ; ∙ convert in dx...
  228.         shr     bl,6
  229.         cmp    bl,0
  230.         je    put1
  231.         shl    bl,4
  232.         add     bl,select
  233. put1:        mov     ds:[di],bl
  234.         inc     di
  235.         mov     bl,dl
  236.         shl     bl,2
  237.         shr     bl,6
  238.         cmp    bl,0
  239.         je    put2
  240.         shl    bl,4
  241.         add     bl,select
  242. put2:        mov     ds:[di],bl
  243.         inc     di
  244.         mov     bl,dl
  245.         shl     bl,4
  246.         shr     bl,6
  247.         cmp    bl,0
  248.         je    put3
  249.         shl    bl,4
  250.         add     bl,select
  251. put3:        mov     ds:[di],bl
  252.         inc     di
  253.         mov     bl,dl
  254.         shl     bl,6
  255.         shr     bl,6
  256.         cmp    bl,0
  257.         je    put4
  258.         shl    bl,4
  259.         add     bl,select
  260. put4:        mov     ds:[di],bl
  261.         inc     di
  262.         inc     si
  263.         loop    @@one
  264.         dec     ax              ; ∙ dec
  265.         jnz     @@two
  266.         ret
  267. select          db      00h
  268. convert         endp
  269. ────────────────────────────────────────────────────────────────────────────────
  270. cga2vga         proc    near
  271.         mov     si,offset logo
  272.         mov     di,offset vgalogo
  273.         mov     ax,39
  274.         mov     bp,200/4
  275.         call    convert
  276.         ret
  277. cga2vga         endp
  278. ────────────────────────────────────────────────────────────────────────────────
  279. fire2scr    proc    near
  280.         mov    si,offset fireblock
  281.         xor    di,di
  282. @scr:        mov    cx,xsize*ysize/4
  283.         rep    movsd
  284.         ret
  285. fire2scr    endp
  286. ────────────────────────────────────────────────────────────────────────────────
  287. newhotline    proc    near
  288.         push    ax
  289.         mov    ax,random1
  290.         mov    bx,random2
  291.         mov    cx,random3
  292.         mov    dx,random4
  293.         ror    dx,cl
  294.         xchg    ch,cl
  295.         rol    ax,cl
  296.         xchg    dx,cx
  297.         xor    bx,cx
  298.         add    ax,bx
  299.         inc    dx
  300.         xchg    dh,dl
  301.         shl    bx,cl
  302.         xchg    dl,dh
  303.         mov    random1,ax
  304.         mov    random2,bx
  305.         mov    random3,cx
  306.         mov    random4,dx
  307.         pop    bx
  308.         mul    bx
  309.         mov    bx,0ffffh
  310.         div    bx
  311.         ret
  312. newhotline    endp
  313. ────────────────────────────────────────────────────────────────────────────────
  314. burning        proc    near
  315.         push    ds
  316.         pop    es
  317.         mov    di,offset fireblock+(ysize-1)*xsize
  318.         mov    si,xsize
  319. newline:    mov    ax,2
  320.         call    newhotline
  321.         cmp    al,1
  322.         jne    putstone
  323.         mov    al,03fh
  324. putstone:    stosb
  325.         dec    si
  326.         jnz    newline
  327.  
  328.         ;xor    bx,bx
  329.         mov    cx,xsize*(ysize-1)/2
  330.         mov    si,offset fireblock
  331. blending:    mov    ax,[si+(xsize-1)]
  332.         add    ax,[si+(xsize+0)]
  333.         add    ax,[si+(xsize+1)]
  334.         add    ax,[si+(xsize*2)]
  335.         cmp    cx,xsize*30
  336.         ja    faster
  337.         dec    ax
  338. faster:        shr    ax,2
  339.         and    ax,03f3fh
  340.         mov    [si],ax
  341.         add    si,2
  342.         loop    blending
  343.         push    0a000h
  344.         pop    es
  345.         ret
  346. burning        endp
  347. ────────────────────────────────────────────────────────────────────────────────
  348. int_key         proc    near
  349.         cli
  350.         push    ax
  351.         in    al,60h
  352.         cmp    al,01            ; ∙ escape
  353.         je    put
  354.         cmp    al,28            ; ∙ return
  355.         je    put
  356.         jmp    none            ; ∙ none
  357. put:        mov    cs:keystroke,al
  358.         jmp    okey
  359. none:        mov    cs:keystroke,0ffh
  360. okey:        in    al,61h
  361.         mov    ah,al
  362.         or    al,80h
  363.         out    61h,al
  364.         sti
  365.         mov    al,20h
  366.         out    20h,al
  367.         pop    ax
  368.         iret
  369. keystroke    db    00
  370. int_key         endp
  371. ────────────────────────────────────────────────────────────────────────────────
  372. initkeyboard    proc    near
  373.         cli
  374.         mov    eax,fs:[9*4]
  375.         mov    oldint9,eax
  376.         mov    ax,cs
  377.         shl    eax,16
  378.         mov    ax,offset int_key
  379.         mov    fs:[9*4],eax
  380.         sti
  381.         ret
  382. oldint9         dd      ?
  383. initkeyboard    endp
  384. ────────────────────────────────────────────────────────────────────────────────
  385. killkeyboard    proc near
  386.         cli
  387.         mov    eax,oldint9
  388.         mov    fs:[9*4],eax
  389.         sti
  390.         ret
  391. killkeyboard    endp
  392. ────────────────────────────────────────────────────────────────────────────────
  393. initsystem      proc    near
  394.         mov     ah,0fh
  395.         int     10h
  396.         mov     oldmode,al
  397.  
  398.         mov     ax,0013h        ; ∙ do all the init
  399.         int     10h            ;   shit
  400.  
  401.         push    cs
  402.         pop    ds
  403.         push    0a000h
  404.         pop    es
  405.  
  406.         mov    si,offset vgapalette
  407.         mov     dx,03c8h             ; ∙ port PEL write mode
  408.         mov     al,00h               ;   at register 00h
  409.         out     dx,al
  410.         inc     dx                   ; ∙ port PEL data register
  411.         mov     cx,0100h*3
  412.         rep    outsb
  413.  
  414.         mov     dx,3d4h
  415.             mov     al,9
  416.             out     dx,al
  417.             inc     dx
  418.             in     al,dx
  419.             and     al,0e0h
  420.             add     al,5
  421.            out    dx,al
  422.  
  423.         ret
  424. oldmode         db      90h
  425. initsystem     endp
  426. ────────────────────────────────────────────────────────────────────────────────
  427. killsystem       proc    near
  428.         xor     ah,ah
  429.         mov     al,oldmode
  430.         int     10h
  431.         mov     ah,12h          ; ∙ restore palette
  432.         mov     bl,31h
  433.         mov     al,00h
  434.         int     10h
  435.         ret
  436. killsystem       endp
  437. ────────────────────────────────────────────────────────────────────────────────
  438. checkkey    proc    near
  439.         cmp byte ptr keystroke,01    ; ∙ escape
  440.         je    escape
  441.         cmp byte ptr keystroke,28    ; ∙ return
  442.         je    return
  443.         jmp    no
  444. escape:        jmp    exit
  445. return:        call    displaylogo
  446. no:        ret
  447. checkkey    endp
  448. ────────────────────────────────────────────────────────────────────────────────
  449. random1        dw    12345
  450. random2        dw    23451
  451. random3        dw    34512
  452. random4        dw    45123
  453.  
  454. fireblock    db    xsize*ysize+200 dup (0)
  455. vgalogo        db    200*39 dup (0)
  456.  
  457. include        hotfire.dat
  458. ────────────────────────────────────────────────────────────────────────────────
  459. main:        call    initsystem
  460.         call    initkeyboard
  461.         call    cga2vga
  462.  
  463. noop:        call    checkkey
  464.         call    burning
  465.         call    fire2scr
  466. ;        call    shades
  467.         jmp    noop
  468.  
  469. exit:        call    killkeyboard
  470.         call    killsystem
  471.         pop    ax
  472.         ret
  473. ────────────────────────────────────────────────────────────────────────────────
  474. code            ends
  475. ────────────────────────────────────────────────────────────────────────────────
  476. end             hotfire
  477.  
  478.